from redis import StrictRedis
import logging

class Config(object):

    SQLALCHEMY_DATABASE_URI='mysql://root:123456@127.0.0.1:3306/news_case'
    SQLALCHEMY_TRACK_MODIFICATIONS=True
    # redis 的ip和端口配置
    REDIS_HOST='127.0.0.1'
    REDIS_PORT=6379
    SECRET_KEY = "SALKDJALKDJALKSJDLASKDJLK"
    # session 从内存中到 redis 中的配置
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=1)
    SESSION_USE_SIGNER = True
    SESSION_PERMANENT = False
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopmentConfig(Config):

    DEBUG=True
    LOG_LEVEL = logging.DEBUG

class ProductionConfig(Config):

    DEBUG=True
    LOG_LEVEL = logging.ERROR

config_dic={
    'development':DevelopmentConfig,
    'production':ProductionConfig
}
